import React, { PureComponent,createRef,forwardRef } from 'react'

// 函数组件
const Hello = forwardRef(function(props, ref) {
  return <h2 ref={ref}>Hello World!</h2>
})
export class App extends PureComponent {
  constructor() {
    super()
     this.Hello = createRef()
  }
  getComponent() {
    console.log(this.Hello.current);

  }
  render() {
    return (
      <div>
        App
        <button onClick={e => this.getComponent()}>获取Hello函数组件内某一个DOM</button>
        <Hello ref={this.Hello } />
      </div>
    )
  }
}

export default App